<html>
<head>
<title>Diary Testing | Search</title>
</head>

<?php 
    include ('./nav.html');
?>

<h3>This is for testing search</h3>

<form name="f1" method="POST" action="search.php">
    <?php 
        include ('./searchinfo.html');
    ?>
    <input type="submit" value="Find blogs">
</form>

<?php
    $blogdate = $_POST["bdate"];
    
    if($blogdate) {
        echo "Searching for blogs for the date ".$blogdate."<br>";
        $db = new SQLiteDatabase("testDB.db");
        $query = $db->query("SELECT * FROM blog WHERE blogdate like '%".$blogdate."%'");
        while($entry = $query->fetch(SQLITE_ASSOC)) {
            echo "result: " . $entry['BID'] . ", " .$entry['blogdate']. ", ".$entry['Title']."<br>";
        }
    }
?>

</html>